package test;

public class Demo11 {
    public static  boolean flag=true;
    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(()->{
            while(flag){
                System.out.println("Hello Thread");
            }
            System.out.println("Bye Bye Thread");
        });
        thread.start();
        Thread.sleep(1000);
        flag=false;
    }
}
